package com.platform.destiny.config;


import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

@Slf4j
@Configuration
public class AppWebStaticConfig extends WebMvcConfigurationSupport {


    @Override
    protected void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");
        registry.addResourceHandler("/favicon.ico").addResourceLocations("classpath:/static/");
        // super.addResourceHandlers(registry);
    }



    @Override
    protected void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(passionInterceptor())
                .addPathPatterns("/**")
                .excludePathPatterns("/static/**");
        // super.addInterceptors(registry);
    }

    @Bean
    public PassionInterceptor passionInterceptor() {
        return new PassionInterceptor();
    }

}
